package net.xo68.destiny.manager.mapper;


import net.xo68.destiny.manager.entity.JobInstanceExtend;
import org.apache.ibatis.annotations.*;
import java.util.List;

/** 
 * JobInstanceExtend mybatis mapper
 * @author wuxie(16349023@qq.com)
 * @date 2020年12月21日 21:43:52
 *
 */
public interface JobInstanceExtendMapper {


	
	@Select("SELECT * FROM destiny_job_instance_extend WHERE ext_key = #{extKey}")
    @Results(value = { 
    @Result(id = true, column = "instance_id", property = "instanceId"),
        @Result(id = true, column = "ext_key", property = "extKey"),
        @Result(column = "ext_value", property = "extValue"),
        @Result(column = "update_time", property = "updateTime")
    })
    JobInstanceExtend find(@Param("extKey") String extKey);
	
	@Select("SELECT * FROM destiny_job_instance_extend")
    @Results(value = { 
    @Result(id = true, column = "instance_id", property = "instanceId"),
        @Result(id = true, column = "ext_key", property = "extKey"),
        @Result(column = "ext_value", property = "extValue"),
        @Result(column = "update_time", property = "updateTime")
    })
    List<JobInstanceExtend> list();
	
	@Insert("insert into destiny_job_instance_extend (instance_id ,ext_key ,ext_value ,update_time ) values (#{instanceId} , #{extKey} , #{extValue} , NOW() )")
    @Options(useGeneratedKeys = true, keyProperty = "extKey")
    int insert(JobInstanceExtend jobInstanceExtend);
	
	@Update({"update destiny_job_instance_extend set",
      " ext_value=#{extValue}, update_time=#{updateTime} ",
      "where ext_key = #{extKey}"
    })
    int update(JobInstanceExtend jobInstanceExtend);

	@Delete("delete FROM destiny_job_instance_extend WHERE instance_id=#{instanceId} and ext_key = #{extKey}")
	int delete(@Param("instanceId") long instanceId,@Param("extKey") String extKey);
}